package cn.whdreamblog.action;

import cn.whdreamblog.entites.User;
import cn.whdreamblog.iservers.IUserServers;
import cn.whdreamblog.servers.UserServers;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ModelDriven;

public class UserAction extends BaseAction implements ModelDriven<User>{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private User u=new User();
	private IUserServers iUserServers= new UserServers();
	private String rootObj="";
	public String login() {
		try {
			//String msg="";
			if(iUserServers.login(u)){
				rootObj="ok";
				//rootObj.put("msg", "ok");
				
			}else{
				rootObj="用户名或密码错误";
				
				//rootObj.put("msg", "用户名或密码错误");
			}
		
			LOG.debug("rootObj:",rootObj.toString());
		} catch (Exception e) {
			LOG.error("login:",e);
		}
		return Action.SUCCESS;
	}

	@Override
	public User getModel() {
		return u;
	}

	public String getRootObj() {
		return rootObj;
	}

	public void setRootObj(String rootObj) {
		this.rootObj = rootObj;
	}


}
